<?php
/**
 * Created by PhpStorm.
 * User: Soha_Ros
 * Date: 17/6/2
 * Time: 上午1:15
 *
 * 删除商品标签
 *
 */
namespace ActionsHttp;

use Data\Food_tags_DAO;

class RestaurantFoodTagsDelete extends BaseActionHttp
{
    public function doAction() {

        parent::doAction();

        // 商铺id
        $restaurant_id = $_SESSION[RESTAURANT_ID];
        $restaurant_id = 1;

        // 分类ID
        $tags_id = $this->data[FOOD_TAG_ID];

        $tag_record = Food_tags_DAO::getRecord($tags_id);

        if (!$tag_record) {
            // 没有该标签
            return $this->SendErrMsg("没有该标签");
        }

        if ($tag_record->getRESTAURANT_ID() != $restaurant_id) {
            // 非法操作
            return $this->SendErrMsg("非法操作");
        }

        // 删除
        Food_tags_DAO::deleteById($tags_id);

        // 返回数据
        $this->ResponseDataToCurrentClient();

    }
}